"""
@name : 11-19 countWalden
@author : hj
@projectname: CJH
"""
import re
with open("Walden.txt", "r") as fp:
    text1 = fp.read()
    text2 = text1.lower()
    text3 = re.sub('[,.?/!":\'-]', '', text2)
    words = text3.split()
    words_dic = {}
    for i in words:
        if i not in words_dic.keys():
            words_dic[i] = 1
        else:
            words_dic[i] += 1

lst = sorted(words_dic.items(), key=lambda kv: kv[1], reverse=True)
print([i for i in lst[:10]])